package chapter67;

import java.util.Scanner;

public class TestLoan {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		Loan loan = new Loan();
		System.out.println("请输入贷款金额：");
		loan.loan = input.nextDouble();
		System.out.println("请选择贷款年限：1、3年（36个月） 2、5年（60个月） 3、20年（240个月）");
		loan.yearChoice = input.nextInt();
		switch(loan.yearChoice){
		case 1:
			loan.yearChoice =3;
			loan.rate = 0.0603;
			break;
		case 2:
			loan.yearChoice = 5;
			loan.rate = 0.0612;
			break;
		case 3:
			loan.yearChoice = 20;
			loan.rate = 0.0639;
			break;
		default:
			System.out.println("输入有误");
			return;
		}
		double money = loan.loan(loan.loan, loan.yearChoice);
		System.out.println("月供为："+money);

	}

}
